package com.bbs2.service;


import java.util.List;

import com.bbs2.dao.PostDao;
import com.bbs2.entity.Post;
import com.bbs2.entity.Repost;
import com.bbs2.util.Page;

public class PostService {
	PostDao pdao = new PostDao();
	public Post findById(String id){
		Post p = pdao.findById(id);
		List<Repost> list = new RepostService().findByPostId(String.valueOf(p.getId()));
		p.setRepostlist(list);
		return p;
	}
	public int save(Post p){
		return pdao.save(p);
	}
	public int getBoardSize(String boardId){
		return pdao.getBoardSize(boardId);
	}
	public int update(Post p){
		return pdao.update(p);
	}
	public int del(String id){
		return pdao.del(id);
	}
	public List<Post> findByBoardId(String id,Page page) {
		return pdao.findByBoardId(id,page);
	}
}
